<template>
    <div class="addcate">
      <div class="cate_hander">
        <h1 class="cate_title">品类管理 -- 添加品类</h1>
      </div>
      <div class="cate_content">
        <el-form label-position="top" label-width="80px" :model="formLabelAlign">
          <el-form-item label="所属品类">
            <el-select v-model="formLabelAlign.region" placeholder="/所有">
              <el-option label="水果" value="shanghai"></el-option>
              <el-option label="甜品" value="beijing"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="品类名称">
            <el-input placeholder="请输入品类名称" v-model="formLabelAlign.name"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">提交</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </template>
  
  <script>
  import { addcategory } from "../../request/http";
  export default {
      name:"addcate",
    data() {
      return {
        formLabelAlign: {
          region: "",
          name: ""
        }
      };
    },
    methods: {
      onSubmit() {
        addcategory({ categoryName: this.formLabelAlign.name }).then(res => {
          console.log(res.data);
          this.$message({
            message: `恭喜${res.data.data}`,
            type: "success"
          });
          this.$router.push("./ShopCategory")
        });
      }
    }
  };
  </script>
  
  
  <style lang="scss" scoped>

  .cate_hander {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .cate_title {
    display: inline-block;
    font-weight: normal;
  }
  </style>